package com.wing.user.model.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 客户端
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("use_client")
public class Client extends BaseEntity<Client> {

    /**
     * 客户端id
     */
    private String clientId;

    /**
     * 客户端密钥
     */
    private String clientSecret;

    /**
     * scopes，以英文逗号分隔
     */
    private String scopes;

    /**
     * 资源ids，以英文逗号分隔
     */
    private String resourceIds;

    /**
     * grant_types，以英文逗号分隔
     */
    private String grantTypes;

    /**
     * 重定向uris，以英文逗号分隔
     */
    private String redirectUris;

    /**
     * 授权码模式自动审批scopes，以英文逗号分隔
     */
    private String autoApproveScopes;

    /**
     * accessToken有效秒数
     */
    private Long accessTokenValiditySeconds;

    /**
     * refreshToken有效秒数
     */
    private Long refreshTokenValiditySeconds;

    /**
     * 权限ids，以英文逗号分隔
     */
    private String authorityIds;


    public Client(
            String clientId,
            String clientSecret,
            String scopes,
            String resourceIds,
            String grantTypes,
            String redirectUris,
            String autoApproveScopes,
            Long accessTokenValiditySeconds,
            Long refreshTokenValiditySeconds,
            String authorityIds
    ){
            this.clientId = clientId;
            this.clientSecret = clientSecret;
            this.scopes = scopes;
            this.resourceIds = resourceIds;
            this.grantTypes = grantTypes;
            this.redirectUris = redirectUris;
            this.autoApproveScopes = autoApproveScopes;
            this.accessTokenValiditySeconds = accessTokenValiditySeconds;
            this.refreshTokenValiditySeconds = refreshTokenValiditySeconds;
            this.authorityIds = authorityIds;
    }
}
